package com.dhcc.core.framework.beetl;

import com.dhcc.core.framework.beetl.format.BeetlXSSFormat;
import com.dhcc.core.framework.beetl.func.*;
import com.dhcc.core.framework.beetl.tag.IncludeExtTag;
import com.dhcc.core.framework.util.CommonUtil;
import org.beetl.ext.spring.BeetlGroupUtilConfiguration;

/**
 * beetl工具配置
 *
 * @ClassName: BeetlConfiguration
 * @Description: 描述
 * @author: cyf
 * @date: 2018年1月2日 上午9:45:47
 */
public class BeetlConfiguration extends BeetlGroupUtilConfiguration {

    @Override
    public void initOther() {

        groupTemplate.registerFunctionPackage("shiro", new ShiroExt());
        groupTemplate.registerFunctionPackage("tool", new CommonUtil());
        
        groupTemplate.registerFunction("dict", new DictFunction());

        groupTemplate.registerFunction("getApplicationConfig", new GetApplicationConfigFunction());
        groupTemplate.registerFunction("getDictsByCode", new GetDictsByCodeFunction());
        groupTemplate.registerFunction("getUserNamesByIds", new GetUserNamesByIdsFunction());
        groupTemplate.registerFunction("getDeptNamesByIds", new GetDeptNamesByIdsFunction());
        groupTemplate.registerFunction("i18n", new I18nFunction());
        groupTemplate.registerFunction("language", new LanguageFunction());

        groupTemplate.registerTag("includeExt", IncludeExtTag.class);
        //注册XSS过滤格式化  * 使用方法 ${a,xss}
        groupTemplate.registerFormat("xss", new BeetlXSSFormat());

    }

}
